package com.wosai.register.service;

import java.util.List;
import java.util.Map;

import com.wosai.register.model.BranchExpend;
import com.wosai.register.model.BranchExpendSubject;
import com.wosai.register.model.BranchExpendType;
import com.wosai.register.model.Category;
import com.wosai.register.model.EmployeeAccount;
import com.wosai.register.model.EmployeeCash;
import com.wosai.register.model.Order;
import com.wosai.register.model.OrderItem;
import com.wosai.register.model.Price;
import com.wosai.register.model.Product;
import com.wosai.register.model.Terminal;
import com.wosai.register.model.Employee;

public interface CoreService {
    
    List<String> insertOrders(List<Order> orders);
    List<String> updateOrders(List<Order> orders);
    List<String> saveOrders(List<Order> orders);
    
    Order findOrderById(String merchantId, String branchId, String terminalId, String orderId);
    List<Order> findOrdersByTerminal(String merchantId, String branchId, String terminalId, int offset, int size, String startDate, String endDate);
    
    void deleteOrder(String merchantId, String branchId, String terminalId, String orderId);
    void deleteOrdersByTerminal(String merchantId, String branchId, String terminalId);
    
    
    void insertOrderItems(List<OrderItem> orderItems);
    void updateOrderItems(List<OrderItem> orderItems);
    
    List<OrderItem> findOrderItemsByOrder(String merchantId, String branchId, String terminalId, String orderId);
    List<OrderItem> findOrderItemsByTerminal(String merchantId, String branchId, String terminalId, int offset, int size);
    
    void deleteOrderItemsByOrder(String merchantId, String branchId, String terminalId, String orderId);
    void deleteOrderItemsByTerminal(String merchantId, String branchId, String terminalId);
    
    
    List<String> insertProducts(List<Product> products);
    List<String> updateProducts(List<Product> products);
    List<String> saveProducts(List<Product> products);
    
    Product findProductById(String merchantId, String productId);
    List<Product> findProductsByTerminal(String merchantId);
    
    void deleteProduct(String merchantId, String productId);
    void deleteProductsByTerminal(String merchantId);

    
    void insertPrices(List<Price> prices);
    void updatePrices(List<Price> prices);
    
    List<Price> findPricesByProductId(String merchantId, String productId);
    List<Price> findPricesByTerminal(String merchantId);
    
    void deletePricesByProduct(String merchantId, String productId);
    void deletePricesByTerminal(String merchantId);

    
    List<String> insertCategories(List<Category> categories);
    List<String> updateCategories(List<Category> categories);
    List<String> saveCategories(List<Category> categories);
    
    Category findCategoryById(String merchantId, String categoryId);
    List<Category> findCategoriesByTerminal(String merchantId);
    
    void deleteCategory(String merchantId, String categoryId);
    void deleteCategoriesByTerminal(String merchantId);

    
    List<String> insertTerminals(List<Terminal> terminals);
    List<String> updateTerminals(List<Terminal> terminals);
    List<String> saveTerminals(List<Terminal> terminals);
    
    Terminal findTerminal(String merchantId, String branchId, String terminalId);
    void deleteTerminal(String merchantId, String branchId, String terminalId);
    
    
    List<String> insertEmployees(List<Employee> employees);
    List<String> updateEmployees(List<Employee> employees);
    List<String> saveEmployees(List<Employee> employees);
    
    Employee findEmployeeById(String merchantId, String employeeId);
    List<Employee> findEmployeesByTerminal(String merchantId);
    
    void deleteEmployee(String merchantId, String employeeId);
    void deleteEmployeesByTerminal(String merchantId);
    
    String createActivationCode(String merchantId, String branchId,
                              String terminalId);
    Map<String, Object> doActivation(String code);
    void doneActivation(String code);

    void changePassword(String username, String password);
    
    List<Map<String, Object>> findTerminalsByUser(String username);
    
    List<EmployeeCash> findEmployeeCashesByTerminal(String merchantId, String branchId, String terminalId);
    void saveEmployeeCashes(List<EmployeeCash> employeeCashes);
    
    List<EmployeeAccount> findEmployeeAccountsByTerminal(String merchantId, String branchId, String terminalId);
    void saveEmployeeAccounts(List<EmployeeAccount> employeeAccounts);

    List<String> insertBranchExpends(List<BranchExpend> expends);
    List<String> updateBranchExpends(List<BranchExpend> expends);
    List<String> saveBranchExpends(List<BranchExpend> expends);
    List<BranchExpend> findBranchExpends(String merchantId, String branchId, String terminalId, String startDate, String endDate);
    
    List<String> insertBranchExpendTypes(List<BranchExpendType> types);
    List<String> updateBranchExpendTypes(List<BranchExpendType> types);
    List<String> saveBranchExpendTypes(List<BranchExpendType> types);
    List<BranchExpendType> findBranchExpendTypes(String merchantId, String branchId, String terminalId);
    

    List<String> insertBranchExpendSubjects(List<BranchExpendSubject> subjects);
    List<String> updateBranchExpendSubjects(List<BranchExpendSubject> subjects);
    List<String> saveBranchExpendSubjects(List<BranchExpendSubject> subjects);
    List<BranchExpendSubject> findBranchExpendSubjects(String merchantId, String branchId, String terminalId);
    
}
